<?php
	session_start();
	extract($_REQUEST);
	require_once("includes/common.php");
	require_once("includes/constants.php");
	require_once("includes/database.php");
	if (insertFabric($f_name ,$f_type, $f_description, $f_color, $f_pattern, $f_image, $f_price_per_m, $f_stock, $f_fabric_width, $f_supplier_id) != 0) {		
		$confirmationMessage = "$f_name has been added into company records." ;
		getAllFabrics(); //update Fabric list in session 
		header( 'Location: confirmationPage.php?' . "confirmationMessage=" .$confirmationMessage) ;
	}
	else {
		$errorMessage = "There was been a problem adding $f_name.";
		header( 'Location: errorPage.php?' . "errorMessage=" . $errorMessage ) ;
	}	
?>
